<!DOCTYPE html>
<html>
<head lang="zh-cmn-Hans">
    <meta charset="UTF-8">
    <title>天和资讯编辑器</title>

    <!--easyui-->
    <script src="plugins/jquery-easyui-1.4.2/jquery.min.js" type="text/javascript"></script>
    <script src="plugins/jquery-easyui-1.4.2/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="plugins/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <link href="plugins/jquery-easyui-1.4.2/themes/default/easyui.css" rel="stylesheet" type="text/css"/>
    <link href="plugins/jquery-easyui-1.4.2/themes/icon.css" rel="stylesheet" type="text/css"/>

    <!--simditor-->
    <link rel="stylesheet" type="text/css" href="plugins/simditor-2.1.5/styles/simditor.css"/>

    <!--<script type="text/javascript" src="plugins/simditor-2.1.5/scripts/jquery.min.js"></script>-->
    <script type="text/javascript" src="plugins/simditor-2.1.5/scripts/module.js"></script>
    <script type="text/javascript" src="plugins/simditor-2.1.5/scripts/hotkeys.js"></script>
    <script type="text/javascript" src="plugins/simditor-2.1.5/scripts/uploader.js"></script>
    <script type="text/javascript" src="plugins/simditor-2.1.5/scripts/simditor.js"></script>

</head>
<script type="text/javascript">

    function content() {
        alert($('#editor').val());
    }

    $(function () {
        var editor = new Simditor({
            textarea: $('#editor'),
            toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', '|', 'source'],
            upload: {
                url: 'upload.action',
                params: null,
                fileKey: 'upload_file',
                connectionCount: 3,
                leaveConfirm: '正在上传文件，如果离开上传会自动取消'
            }
        });
//    var editor = new Simditor({
//        textarea: $('#editor')
//    });
    });

    //    (function() {
    //        $(function() {
    //            var editor, mobileToolbar, toolbar;
    //            toolbar = ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', '|', 'source'];
    ////            mobileToolbar = ["bold", "underline", "strikethrough", "color", "ul", "ol"];
    ////            if (mobilecheck()) {
    ////                toolbar = mobileToolbar;
    ////            }
    //            return editor = new Simditor({
    //                textarea: $('#txt-content'),
    //                placeholder: '这里输入文字...',
    //                toolbar: toolbar,
    //                pasteImage: true,
    //                defaultImage: 'assets/images/image.png',
    //                upload: location.search === '?upload' ? {
    //                    url: '/upload'
    //                } : false
    //            });
    //        });
    //
    //    }).call(this);

</script>
<body>

<form id="newsForm" method="post" action="/admin">

    <table cellpadding="5" width="100%">
        <tr>
            <td>标题:</td>
            <td>
                <input class="easyui-textbox" type="text" name="title"
                       style="width:300px;;height:26px"
                       data-options="required:true"/>
            </td>
            <td>分类:</td>
            <td>
                <select class="easyui-combobox" name="category">
                    <option value="news">新闻</option>
                    <option value="bg">通知</option>
                    <option value="ca">公告</option>
                    <option value="zh-cht">资讯</option>
                    <option value="cs">处分h</option>
                </select>
            </td>
        </tr>
    </table>

    <textarea name="content" id="editor" placeholder="这里输入内容" autofocus>

    </textarea>

</form>

<div style="text-align:center;padding:5px">
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save'"
       onclick="submitForm()">发布</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-man'"
       onclick="clearForm()">预览</a>
</div>

<script>
    function submitForm() {
        alert("b");
        $('#newsForm').form('submit');
        alert("a");
    }
    function clearForm() {
        $('#newsForm').form('clear');
    }
</script>

<!--<p>-->
<!--<input onclick="content();" type="button" value="show"/>-->
<!--</p>-->

</body>
</html>
